<%-- internal/maintain/menu/index.jsp --%>

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<%@page import="java.util.*" %>
<%@page import="problemDomain.EmployeeAccountBean"%>
<%@page import="problemDomain.EmployeeAccountBean.Position"%>

<%
	// get the currently logged on employee from session
	EmployeeAccountBean employee = (EmployeeAccountBean)session.getAttribute("employee");
	EmployeeAccountBean.Position pos = null;
	if (employee != null)
		pos = employee.getPosition();
	else {
		response.sendRedirect("../../login/");
		return;
	}
	
	if (pos != Position.MANAGER) {
		response.sendRedirect("../../login/");
		return;
	}
%>



<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
		<link type="text/css" rel="stylesheet" href="../../css/general.css" />
		<link type="text/css" rel="stylesheet" href="../../css/framed.css" />
		<link type="text/css" rel="stylesheet" href="../../css/menu/form.css" />
		<script type="text/javascript" src="../../js/ajax-handler.js"></script>
		<script type="text/javascript" src="../../js/form.js"></script>
		<script type="text/javascript" src="../../js/dialog.js"></script>
		<script type="text/javascript" src="../../js/menu/maintain.js"></script>
		<script type="text/javascript" src="../../js/menu/form.js"></script>
		<title>ORDRS - Maintain Menu</title>
	</head>
		
	<body onload="loadPage()">
			<!-- Title -->
			<div class="pageTitle">
				<img src="../../images/logo.bmp" />
				<!-- Logout -->
				<div class="navi">
					<table class="navi" align="right">
						<tr>
						<%
						out.println("<td class=\"navi\"><a href=\"../delivery/\">Delivery</a></td>");
						out.println("<td class=\"navi\"><a href=\"../food-item/\">Food Item</a></td>");
						out.println("<td class=\"navi\"><a href=\"../employee/\">Employee</a></td>");
						out.println("<td class=\"navi\"><a href=\"../menu-item/\">Menu Item</a></td>");
						out.println("<td class=\"navi\"><a href=\"../menu/\">Order</a></td>");
						out.println("<td class=\"navi\"><a href=\"../../view/report/\">Report</a></td>");
						out.println("<td class=\"navi\"><a href=\"../reservation/\">Reservation</a></td>");
						%>
							
							<td class="navi"><a href="../../login/">Logout</a></td>
						</tr>
					</table>
				</div>
				<!-- END Logout -->
			</div>
			<!-- END Title -->		
			
			<!-- Panel -->			
			<div class="panel">
			<fieldset>
			<legend style="font-size: 36px;">Maintain Menu</legend>
				<table style="border: 0px; width: 100%;">
					<tr style="height: 0">
						<td rowspan="3">
						
							<!-- Fields -->
							
							<div  class="fields">
								<!-- hidden inputs -->
								
								<input id="menuID" type="hidden" value="" />
								<input id="menuItemID" type="hidden" value="" />
								<input id="itemInMenuID" type="hidden" value="" />
								
								<!-- END hidden inputs -->
								<table align="center">
									<tr>
										<td><h4>Menu Info</h4></td>
									</tr>
									<tr>
										<td class="fieldLabel">* Name:</td>
										<td><input id="name" type="text" maxlength="25"/></td>
										<td id="nameMessage"></td>
									</tr>
									<tr>
										<td class="fieldLabel">Description:</td>
										<td><textArea id="description" type="text" maxlength="225" wrap="soft"></textArea></td>
										<td id="descriptionMessage"></td>
									</tr>
									<tr>
										<td class="fieldLabel">Activity:</td>
										<td>
											<form name="activityForm">
												<input type="radio" name="activity" value="true" checked="checked"/>Active
												<input type="radio" name="activity" value="false" />Inactive 
											</form>
										</td>
									</tr>
								</table>
								
							</div>
							
							<!-- END Fields -->
						</td>
						
					</tr>	
					<tr>
						<td rowspan="2" class="verrule" ></td>	
						<td class="resultsHead">Menu List
						</td>
						<td>
							<!-- List All Button -->
							<ul class="toolbar">
								<li onclick="listAllMenu()">List All</li>
							</ul> 
							
						</td>
					</tr>
					<tr>
						<td class="resultsTD" colspan="2">
							<!-- Results -->
							
							<div id="results" class="resultsPanel">
							</div>
							
							<!-- END Results -->
						
						</td>
					</tr>
					<tr valign="top">
						<td class="menuTD">
							<!-- Menu Item in Menu List -->
							
							<h4>Items in this Menu</h4>
									
							<div id="itemInMenuList" class="orderItemListPanel"></div>
							
							<!-- END Menu Item in Menu List -->
						</td>
						<td>
							
							<!-- Add/Remove Buttons -->
							<div class="addRemovePanel">
								<table align="center">
									<tr><td><br><br><br></td>
									</tr>
									<tr>
										<td class="buttonTD"><input type="button" onclick="addItem()" value="&lt"/></td>
									</tr>
									<tr><td><br><br></td>
									</tr>
									<tr>
										<td class="buttonTD"><input type="button" onclick="removeItem()" value="&gt"/></td>
									</tr>
									<tr><td><br><br></td>
									</tr>
								</table>
							
							</div>
							<!-- END Add/Remove Buttons -->
							
						</td>
						<td colspan="2" class="menuTD">
						
							<!-- Menu Item Panel -->
							
							<h4>Menu Item</h4>
							<form name="showOpForm">
								<input type="radio" name="showOp" onclick="listMenuItem()"/>All Items
								<input type="radio" name="showOp" onclick="listMenuItem()"/>Available Items
							</form>
							
							<div id="menuItemList" class="menuItemListPanel"></div>
							
							<!-- END Menu Item Panel -->
						
						</td>
					</tr>
					
					<tr>
						<td style="vertical-align: top; padding-top: 10px;" align="center">
							<!-- Toolbar -->
							<ul class="toolbar">
								<li onclick="createMenu(false)">Create</li>
								<li onclick="reportMenu()">Search</li>
								<li onclick="updateMenu()">Update</li>
								<li onclick="deleteMenu()">Delete</li>
								<li onclick="resetFields()">Clear</li>
							</ul>
							<!-- END Toolbar -->
						
						</td>
						<td>
						</td>
						<td>
							<table align="center">
								<tr>
									<td rowspan="2"></td>
									<td class="fieldLabel">Item No.:</td>
									<td><input type="text" id="itemNumber" maxlength="4S" /></td>
									<td id="itemNumberMessage"></td>
								</tr>
								<tr>
									<td class="fieldLabel">Name:</td>
									<td><input type="text" id="itemName" maxlength="25" /></td>
								</tr>
							</table>
						</td>
						<td>
							<ul class="toolbar">
								<li onclick="searchMenuItem()">Search</li>
							</ul>
						</td>
					</tr>
				</table>
			</fieldset>
			</div>
			
			<!-- END Panel -->
	</body>
</html>
